package com.lazy.mapper;


import com.github.pagehelper.Page;
import com.lazy.dto.CategoryPageQueryDTO;
import com.lazy.entity.repair.Category;
import com.lazy.entity.repair.RepairCategoriesSubcategory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {

    /**
     * 分类分页查询
     */

    Page<Category> pageQuery(CategoryPageQueryDTO categoryPageQueryDTO);

    @Select("select * from repair_categories_subcategory")
    List<RepairCategoriesSubcategory> selectSubcategory();

    @Select("select * from repair_categories")
    List<Category> selectCategory();

    @Insert("insert into repair_categories_subcategory(category_id, name, create_time, update_time) " +
            "VALUES (#{categoryId} ,#{name} ,#{createTime} ,#{updateTime} )")
    void add(RepairCategoriesSubcategory repairCategoriesSubcategory);


    /**
     * 根据id批量删除
     * @param id
     */
    void delete(List<Integer> id);


    Category selectById(Integer id);

    Integer update(RepairCategoriesSubcategory repairCategoriesSubcategory);
}
